﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComputerGraphics.Graphics;

namespace ComputerGraphics.Geometry
{
    public class Cube : CompoundShape
    {
        public Cube(Point3D origin, Point3D x, Point3D y, Point3D z, Texture texture)
            : base(texture)
        {
            AddShape(new Parallelogram(origin, x, y, null));
            AddShape(new Parallelogram(origin, x, z, null));
            AddShape(new Parallelogram(origin, y, z, null));
            origin = origin + x + y + z;
            x = -x;
            y = -y;
            z = -z;
            AddShape(new Parallelogram(origin, x, y, null));
            AddShape(new Parallelogram(origin, x, z, null));
            AddShape(new Parallelogram(origin, y, z, null));
        }

        public override Intersection InternalIntersect(Ray r)
        {
            return Intersect(r);
        }
    }
}
